<?php
  header('Content-Type:text/html;charset=utf-8');
  $pdo=new PDO('mysql:host=localhost;dbname=dtb','root','');
  $sql=<<<EOF
    CREATE TABLE IF NOT EXISTS user(
      id INT UNSIGNED AUTO_INCREMENT KEY,
      username VARCHAR(20) NOT NULL UNIQUE,
      password CHAR(70) NOT NULL,
      email VARCHAR(32) NOT NULL,
      headPic VARCHAR(50) NOT NULL,
      adminRank INT NOT NULL
    );
EOF;
  $res=$pdo->exec($sql);
  var_dump($res);
  $sql=<<<EOF
    CREATE TABLE IF NOT EXISTS passage(
      id INT UNSIGNED AUTO_INCREMENT KEY,
      title VARCHAR(30) NOT NULL,
      mainText VARCHAR(1500) NOT NULL,
      createDate VARCHAR(30) NOT NULL,
      authorID INT NOT NULL,
      authorName VARCHAR(20) NOT NULL,
      authorAdminRank INT NOT NULL
    );
EOF;
  $res=$pdo->exec($sql);
  var_dump($res);
  $sql="INSERT INTO user(username,password,email,headPic,adminRank) VALUES('admin','".md5('admin').md5('admin')."','admin@wamp.fr','1',2);";
  var_dump($pdo);
  $res=$pdo->exec($sql);
  var_dump($res);
?>